select to_date(GHRIFW.CHECKDATE,'yyyy-mm-dd') DAKQ,GHRIFW.*,formmain_0115.id from GHRIFW
left outer join formmain_0115 on trim(GHRIFW.USERID)=trim(formmain_0115.FIELD0001)and trim(GHRIFW.CHECKTIME)=trim(formmain_0115.FIELD0006)
AND to_date(GHRIFW.CHECKDATE,'yyyy-mm-dd')=trim(formmain_0115.field0004)
where formmain_0115.ID is null